/**
 * Contains {@link Connector}
 */
package logic.connectors;

import java.io.Serializable;

import logic.pathelements.PathElement;

/**
 * Base network connector
 * @author Alexey Akimov <frinatella@gmail.com>
 */
public class Connector implements Serializable {
    
    /**
	 * 
	 */
	private static final long serialVersionUID = -6329120220331806480L;

	/**
     * Connector's owner
     */
    private PathElement owner;
    
    /**
     * Connector is connected this connector
     */
    private Connector otherConnector;
    
    /**
     * Constructor defines connector's owner
     * @param owner connector's owner
     */
    public Connector(PathElement owner) {
        this.owner = owner;
    }
    
    /**
     * Getter
     * @return this connector's owner
     */
    public PathElement getOwner() {
        return owner;
    }

    /**
     * Getter
     * @return connector is connected this connector
     */
    public Connector connectedTo() {
        return otherConnector;
    }
    
    /**
     * Setter
     * @param otherConnector connector will be connected this connector
     */
    public void connectTo(Connector otherConnector) {
        this.otherConnector = otherConnector;
    }
    
    /**
     * Disconnect this connector from other connector
     */
    public void disconnect() {
        otherConnector = null;
    }
}
